package com.example.wechathook.util;

import de.robv.android.xposed.XSharedPreferences;

/**
 * 红包hook配置
 * 
 * @author chencq
 *
 */
public class PreferenceUtils {

	private static XSharedPreferences instance = null;

	private static XSharedPreferences getInstance() {
		if (instance == null) {
			instance = new XSharedPreferences(PreferenceUtils.class.getPackage().getName());
			instance.makeWorldReadable();
		} else {
			instance.reload();
		}
		return instance;
	}
	
	/********************************* 系统信息hook配置 ********************************/
	public static boolean isSystemSwitch(){
		return getInstance().getBoolean("systemSwitch", false);
	}
	
	public static String board(){
		return getInstance().getString("board", "");
	}
	
	public static String device(){
		return getInstance().getString("device", "");
	}
	
	public static String display(){
		return getInstance().getString("display", "");
	}
	
	public static String fingerprint(){
		return getInstance().getString("fingerprint", "");
	}
	
	public static String host(){
		return getInstance().getString("host", "");
	}
	
	public static String manufacturer(){
		return getInstance().getString("manufacturer", "");
	}
	
	public static String model(){
		return getInstance().getString("model", "");
	}
	
	public static String product(){
		return getInstance().getString("product", "");
	}
	
	public static String tags(){
		return getInstance().getString("tags", "");
	}
	
	public static String type(){
		return getInstance().getString("type", "");
	}
	
	public static String user(){
		return getInstance().getString("user", "");
	}
	
	public static String imei(){
		return getInstance().getString("imei", "");
	}
	
	public static String simNumber(){
		return getInstance().getString("simNumber", "");
	}
	
	public static String mac(){
		return getInstance().getString("mac", "");
	}

	public static String androidId(){
		return getInstance().getString("androidId", "");
	}
	
	/********************************* 红包hook配置 ********************************/
	public static boolean redPacketSwitch() {
		return getInstance().getBoolean("redPacketSwitch", false);
	}

	public static boolean notSelf() {
		return getInstance().getBoolean("not_self", false);
	}

	public static boolean notWhisper() {
		return getInstance().getBoolean("not_whisper", false);
	}

	public static boolean notMute() {
		return getInstance().getBoolean("not_mute", false);
	}

	public static boolean delay() {
		return getInstance().getBoolean("delay", false);
	}

	public static int delayTime() {
		return getInstance().getInt("delay_time", 0);
	}

	public static boolean locationSwtich() {
		return getInstance().getBoolean("locationSwtich", false);
	}

	/********************************* 定位hook配置 ********************************/
	// 纬度
	public static String lat() {
		return getInstance().getString("lat", "0.0");
	}

	// 经度
	public static String lon() {
		return getInstance().getString("lon", "0.0");
	}

	// 国家代码
	public static int mcc() {
		return 460;
	}

	public static int mnc() {
		return getInstance().getInt("mnc", 0);
	}

	// 位置区域代码
	public static int lac() {
		return getInstance().getInt("lac", 0);
	}

	// 基站编号
	public static int cid() {
		return getInstance().getInt("cid", 0);
	}

	/********************************* 随机hook配置 ********************************/
	public static boolean diceCheat() {
		return getInstance().getBoolean("dice_cheat", false);
	}

	public static int diceNum() {
		return Integer.parseInt(getInstance().getString("dice_num", "0"));
	}

	public static boolean moraCheat() {
		return getInstance().getBoolean("mora_cheat", false);
	}

	public static int moraNum() {
		return Integer.parseInt(getInstance().getString("mora_num", "0"));
	}

}
